<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('光刻板出入库管理')" />
	<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="post-form">
					<div class="select-list">
						<ul>
							<li>
								光刻板名称：<input type="text" name="lightPlateNo" />
							</li>
							<li>
								<label>日期：</label>
								<input type="text" class="input-sm" id="laydate-startTime" name="createTimeStart" placeholder="起始日期" />
								<span>~</span>
								<input type="text" class="input-sm" id="laydate-endTime" name="createTimeEnd" placeholder="结束日期" />
							</li>
							<li>
								出入库类型：<select name="operateType" th:with="type=${@dict.getType('operate_type')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ph:warehouse:export">
		            <i class="fa fa-download"></i> 导出
		        </a>
	        </div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table" style="table-layout:fixed;word-break:break-all;"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: datetimepicker-js" />
	<script th:inline="javascript">
		var datas = [[${@dict.getType('sys_normal_disable')}]];
		var operateTypes = [[${@dict.getType('operate_type')}]];
		var prefix = ctx + "ph/warehouse";
		var splictPage = [10, 15, 20, 30, 50];

		var columnArrys = new Array(4);
		columnArrys = [
			{
				checkbox: true,
				width: 20
			},
			{
				field: 'NO',
				title: 'NO',
				width: 20,
				align: "center",
				formatter: function (value, row, index) {
					//获取每页显示的数量
					var pageSize=$('#bootstrap-table').bootstrapTable('getOptions').pageSize;
					//获取当前是第几页
					var pageNumber=$('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
					//返回序号，注意index是从0开始的，所以要加上1
					return pageSize * (pageNumber - 1) + index + 1;
				}
			},
			{
				field: 'lightPlateNo',
				title: '光刻板名称',
				sortable: true,
				width: 80
			},
			{
				field: 'operateType',
				title: '出入库类型',
				sortable: true,
				width: 30,
				align: 'center',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(operateTypes, value);
				}
			},
			{
				field: 'createTime',
				title: '出入库时间',
				sortable: true,
				width: 80
			},
			{
				field: 'jobNumber',
				title: '操作人',
				sortable: true,
				width: 40
			},
			{
				field: 'employeeName',
				title: '操作人名称',
				width: 40
			}
		];
		$(function() {

			layui.use('laydate', function(){
				var laydate = layui.laydate;
				var startDate = laydate.render({
					elem: '#laydate-startTime',
					max: $('#laydate-endTime').val(),
					theme: 'molv',
					trigger: 'click',
					done: function(value, date) {
						// 结束时间大于开始时间
						if (value !== '') {
							endDate.config.min.year = date.year;
							endDate.config.min.month = date.month - 1;
							endDate.config.min.date = date.date;
						} else {
							endDate.config.min.year = '';
							endDate.config.min.month = '';
							endDate.config.min.date = '';
						}
					}
				});

				var endDate = laydate.render({
					elem: '#laydate-endTime',
					min: $('#laydate-startTime').val(),
					theme: 'molv',
					trigger: 'click',
					done: function(value, date) {
						// 开始时间小于结束时间
						if (value !== '') {
							startDate.config.max.year = date.year;
							startDate.config.max.month = date.month - 1;
							startDate.config.max.date = date.date;
						} else {
							startDate.config.max.year = '';
							startDate.config.max.month = '';
							startDate.config.max.date = '';
						}
					}
				});
			});

		    var options = {
		        url: prefix + "/list",
		        exportUrl: prefix + "/export",
		        sortName: "createTime",
				sortOrder: "desc",
		        modalName: "光刻板出入库记录",
		        columns: columnArrys,
				pageList: splictPage,
				showHeader: true
		    };
		    $.table.init(options);
		});
	</script>
</body>
</html>